from manim import *

class CreateCircle(Scene):
    def construct(self):
        circle = Circle()
        circle.set_fill(PINK, opacity=0.5)

        self.play(Create(circle))

class SquareToCircle(Scene):
    def construct(self):
        circle = Circle()
        circle.set_fill('#66ccff', opacity=0.5)
        
        square = Square()
        square.rotate(PI/4)

        self.play(Create(square))
        self.play(Transform(square, circle))
        self.play(FadeOut(square))

class CircleAndSquare(Scene):
    def construct(self):
        circle = Circle()
        circle.set_fill(PINK, 1)

        square = Square()
        square.set_fill("#66ccff", 1)

        square.next_to(circle, RIGHT, buff=0.5)
        self.play(Create(circle), Create(square))

class AnimatedSquareToCircle(Scene):
    def construct(self):
        circle = Circle()
        circle.set_fill("#66ccff", 1)
        square = Square()
        self.next_section()
        self.play(Create(square))
        self.next_section("hello")
        self.play(square.animate.rotate(PI/2))
        self.play(Transform(square, circle))

class FlipAndShift(Scene):
    def construct(self):
        square = Square()
        square.set_fill("#66ccff", 0.8)
        square.rotate(PI/4)
        self.play(Create(square))
        self.play(square.animate.flip())
        self.play(square.animate.shift((1, 1, 0)))

class DifferentRotations(Scene):
    def construct(self):
        left_square = Square(color=BLUE, fill_opacity=0.7).shift(2 * LEFT)
        right_square = Square(color=GREEN, fill_opacity=0.7).shift(2 * RIGHT)
        self.play(
            left_square.animate.rotate(PI/4), Rotate(right_square, angle=PI), run_time=2
        )
        self.wait()